package data;

import java.util.Date;

import com.EntityName;
import com.google.appengine.api.datastore.Entity;

public class AuditTrail extends AbstractData {
	
	private transient long id = -1;
	private String title;
	private Date stampDate;
 
	public AuditTrail() {
	
	}
 
	public AuditTrail( long id) {
		this.id = id;
	}
 
	public long getId() {
		return id;
	}
	
	public void setId(long id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}


	public void setTitle(String title) {
		this.title = title;
	}


	public Date getStampDate() {
		return stampDate;
	}


	public void setStampDate(Date stapDate) {
		this.stampDate = stapDate;
	}


@Override
public Entity getEntity() {

	Entity item;
	if(this.key == null)
		item = new Entity(EntityName.AuditTrail);
	else
		item = new Entity(this.key);

	item.setProperty("title", this.title);
	item.setProperty("stampDate", this.stampDate);
	
	return item;
	
}

@Override
public void setEntity(Entity entity) {
	this.id = entity.getKey().getId();
	this.title = (String) entity.getProperty("title");
	this.stampDate = (Date) entity.getProperty("stampDate");

	this.key = entity.getKey();
}

public void LoadData() {
	if (this.id > -1) {
		Entity entity = LoadData(EntityName.AuditTrail, this.id);
		setEntity(entity);
	}
}
 
}